#include "Mutex.h"

namespace GPUCC
{
	namespace CPU
	{
		Mutex::Mutex() : m_Mutex(NULL)
		{
			m_Mutex = CreateMutex(NULL, FALSE, NULL);
		}

		Mutex::~Mutex()
		{
			CloseHandle(m_Mutex);
		}

		void Mutex::Acquire()
		{
			WaitForSingleObject(m_Mutex, INFINITE);
		}

		bool Mutex::Release()
		{
			return (ReleaseMutex(m_Mutex));
		}
	}
}